package com.server.questionbank.snframe.service.CourseService.Impl;

import com.server.questionbank.snframe.domain.Course.TKnowledge;
import com.server.questionbank.snframe.domain.QuestionBank.Knowledge;
import com.server.questionbank.snframe.mapper.Course.TKnowledgeMapper;
import com.server.questionbank.snframe.service.CourseService.TKnowledgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TKnowledgeServiceImpl implements TKnowledgeService {

    @Autowired
    private TKnowledgeMapper tKnowledgeMapper;


    // 根据recordId查询知识点
    @Override
    public List<Knowledge> getKnowledgeById(Long recordId) {
        return tKnowledgeMapper.getKnowledgeById(recordId);
    }

    // 根据courseId查询知识点
    @Override
    public List<Knowledge> getKnowledgeByCourseId(Long courseId) {
        return tKnowledgeMapper.getKnowledgeByCourseId(courseId);
    }

    // 根据cameraId查询知识点
    @Override
    public List<Knowledge> getKnowledgeByCameraId(Long cameraId) {
        return tKnowledgeMapper.getKnowledgeByCameraId(cameraId);
    }

    // 根据courseId和cameraId查询知识点
    @Override
    public List<Knowledge> getKnowledgeByCourseIdAndCameraId(Long courseId, Long cameraId) {
        return tKnowledgeMapper.getKnowledgeByCourseIdAndCameraId(courseId, cameraId);
    }

    // 根据quoteRecordId查询知识点
    @Override
    public List<Knowledge> getKnowledgeByQuoteRecordId(Long quoteRecordId) {
        return tKnowledgeMapper.getKnowledgeByQuoteRecordId(quoteRecordId);
    }

    // 根据exercisesId查询知识点
    @Override
    public List<Knowledge> getKnowledgeByExercisesId(Long exercisesId) {
        return tKnowledgeMapper.getKnowledgeByExercisesId(exercisesId);
    }

    // 创建知识点
    @Override
    public Boolean createKnowledge(TKnowledge knowledge) {
        return tKnowledgeMapper.createKnowledge(knowledge) > 0;
    }

    @Override
    public Boolean removeKnowledge(Long recordId) {
        return tKnowledgeMapper.removeKnowledge(recordId) > 0;
    }
}
